<template>
      <el-form :inline="true"  class="demo-form-inline category-selector categorySelector" :disabled="isdisabled">
    <el-form-item label="一级分类">
        <el-select v-model="categorylistid1" class="m-2" placeholder="请选择" size="large">
            <el-option v-for="item in categoryliststor.category1list" :key="item.id" :label="item.name" :value="item.id"/>
        </el-select>
    </el-form-item>
    <el-form-item label="二级分类">
        <el-select v-model="categorylistid2" class="m-2" placeholder="请选择" size="large">
            <el-option v-for="item in categoryliststor.category2list" :key="item.id" :label="item.name" :value="item.id" />
        </el-select>
    </el-form-item>
    <el-form-item label="三级分类">
        <el-select v-model="categoryliststor.categorySelectorid3" class="m-2" placeholder="请选择" size="large">
            <el-option v-for="item in categoryliststor.category3list" :key="item.id" :label="item.name" :value="item.id" />
        </el-select>
    </el-form-item>
  </el-form>
</template>

<script lang="ts">
    export default {
        name:'CategorySelector'
    }
</script>

<script lang="ts" setup>
import { computed, onMounted, ref ,defineProps} from 'vue'

import type { CategorySelectorlistmodul } from '@/api/Product/model/CategorySelectormodul'

import  usercategorylist  from '@/stores/category'

let {isdisabled} = defineProps(['isdisabled'])


const categoryliststor = usercategorylist()
onMounted(()=>{
  categoryliststor.getcategory1list()
})

let categorylistid1 = computed({
  get(){
     return categoryliststor.categorySelectorid1
  },
  set(val){
    categoryliststor.getcategory2list(val as number)
  }
})

let categorylistid2 = computed({
  get(){
     return categoryliststor.categorySelectorid2
  },
  set(val){
    categoryliststor.getcategory3list(val as number)
  }
})


</script>

<style lang="scss"  scoped>
.category-selector{
  .el-form-item {
    margin-bottom:0;
  }
}
</style>